<template>
    <div class="UrlTemplateImageryProvider">
        <cesium-viewer @viewerAlready="viewerAlready">
        </cesium-viewer>
        <div>
            <highlight-js code-type="javascript">
                {{ textHtml }}
            </highlight-js>
        </div>
    </div>
</template>

<script>
    import CesiumViewer from "../../CesiumViewer";
    import {addAdditionalLayerOption} from "../../../utils/layersHandler";
    import HighlightJs from "../../HighlightJs";

    export default {
        name: "UrlTemplateImageryProvider",
        //import引入的组件需要注入到对象中才能使用",
        components: {HighlightJs, CesiumViewer},
        data() {
            //这里存放数据",
            return {
                textHtml: '          viewer.imageryLayers.addImageryProvider(\n' +
                    '                       new Cesium.UrlTemplateImageryProvider({\n' +
                    '                            maximumLevel:18,//最大缩放级别\n' +
                    '                            url : \'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}\'\n' +
                    '                            style: "default",\n' +
                    '                            format: "image/png"\n' +
                    '                        })\n' +
                    '                    );'
            };
        },
        //方法集合",
        methods: {
            viewerAlready() {
                addAdditionalLayerOption(
                    "UrlTemplateImageryProvider",
                    new Cesium.UrlTemplateImageryProvider({
                        maximumLevel:18,//最大缩放级别
                        url : 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
                        style: "default",
                        format: "image/png"
                    })
                );
            }
        }
    }
</script>

